-text "This window displays a string of text to demonstrate the text facilities of canvas widgets. You can point, click, and type. You can also select and then delete with Control-d. You can copy the selection with Control-v. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification."
pack append $w.frame1 $w.frame1.m {frame center}
set font -Adobe-helvetica-medium-r-*-240-*
$c create rectangle 245 195 255 205 -outline black -fill red
# First, create the text item and give it bindings so it can be edited.
$c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. You can point, click, and type. You can also select and then delete with Control-d." -width 440 -anchor n -font $font -justify left]
$c bind text <1> "textB1Press $c %x %y"
$c bind text <B1-Motion> "textB1Move $c %x %y"
$c bind text <Shift-1> "$c select adjust current @%x,%y"
$c bind text <Shift-B1-Motion> "textB1Move $c %x %y"
$c bind text <KeyPress> "$c insert text cursor %A"
$c bind text <Shift-KeyPress> "$c insert text cursor %A"
$c bind text <Control-h> "textBs $c"
$c bind text <Delete> "textBs $c"
$c bind text <Control-d> "$c dchars text sel.first sel.last"
$c bind text <Control-v> "$c insert text cursor \[selection get\]"
# Next, create some items that allow the text's anchor position
# to be edited.
set x 50
set y 50
set color LightSkyBlue1
mkTextConfig $c $x $y -anchor se $color
mkTextConfig $c [expr $x+30] [expr $y] -anchor s $color